// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

#include <PySPHResampleAttributes.h>
#include <ObserverToCallback.h>
#include <stdio.h>
#include <Py2and3Support.h>

// ****************************************************************************
// Module: PySPHResampleAttributes
//
// Purpose:
//
// Note:       Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation:   omitted
//
// ****************************************************************************

//
// This struct contains the Python type information and a SPHResampleAttributes.
//
struct SPHResampleAttributesObject
{
    PyObject_HEAD
    SPHResampleAttributes *data;
    bool        owns;
    PyObject   *parent;
};

//
// Internal prototypes
//
static PyObject *NewSPHResampleAttributes(int);
std::string
PySPHResampleAttributes_ToString(const SPHResampleAttributes *atts, const char *prefix, const bool forLogging)
{
    std::string str;
    char tmpStr[1000];

    snprintf(tmpStr, 1000, "%sminX = %g\n", prefix, atts->GetMinX());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%smaxX = %g\n", prefix, atts->GetMaxX());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sxnum = %d\n", prefix, atts->GetXnum());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sminY = %g\n", prefix, atts->GetMinY());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%smaxY = %g\n", prefix, atts->GetMaxY());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%synum = %d\n", prefix, atts->GetYnum());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sminZ = %g\n", prefix, atts->GetMinZ());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%smaxZ = %g\n", prefix, atts->GetMaxZ());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sznum = %d\n", prefix, atts->GetZnum());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%stensorSupportVariable = \"%s\"\n", prefix, atts->GetTensorSupportVariable().c_str());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sweightVariable = \"%s\"\n", prefix, atts->GetWeightVariable().c_str());
    str += tmpStr;
    if(atts->GetRK())
        snprintf(tmpStr, 1000, "%sRK = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sRK = 0\n", prefix);
    str += tmpStr;
    return str;
}

static PyObject *
SPHResampleAttributes_Notify(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    obj->data->Notify();
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_SetMinX(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    float cval = float(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ float");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ float");
    }

    Py_XDECREF(packaged_args);

    // Set the minX in the object.
    obj->data->SetMinX(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetMinX(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(double(obj->data->GetMinX()));
    return retval;
}

/*static*/ PyObject *
SPHResampleAttributes_SetMaxX(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    float cval = float(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ float");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ float");
    }

    Py_XDECREF(packaged_args);

    // Set the maxX in the object.
    obj->data->SetMaxX(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetMaxX(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(double(obj->data->GetMaxX()));
    return retval;
}

/*static*/ PyObject *
SPHResampleAttributes_SetXnum(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the xnum in the object.
    obj->data->SetXnum(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetXnum(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetXnum()));
    return retval;
}

/*static*/ PyObject *
SPHResampleAttributes_SetMinY(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    float cval = float(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ float");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ float");
    }

    Py_XDECREF(packaged_args);

    // Set the minY in the object.
    obj->data->SetMinY(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetMinY(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(double(obj->data->GetMinY()));
    return retval;
}

/*static*/ PyObject *
SPHResampleAttributes_SetMaxY(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    float cval = float(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ float");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ float");
    }

    Py_XDECREF(packaged_args);

    // Set the maxY in the object.
    obj->data->SetMaxY(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetMaxY(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(double(obj->data->GetMaxY()));
    return retval;
}

/*static*/ PyObject *
SPHResampleAttributes_SetYnum(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the ynum in the object.
    obj->data->SetYnum(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetYnum(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetYnum()));
    return retval;
}

/*static*/ PyObject *
SPHResampleAttributes_SetMinZ(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    float cval = float(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ float");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ float");
    }

    Py_XDECREF(packaged_args);

    // Set the minZ in the object.
    obj->data->SetMinZ(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetMinZ(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(double(obj->data->GetMinZ()));
    return retval;
}

/*static*/ PyObject *
SPHResampleAttributes_SetMaxZ(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    float cval = float(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ float");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ float");
    }

    Py_XDECREF(packaged_args);

    // Set the maxZ in the object.
    obj->data->SetMaxZ(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetMaxZ(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(double(obj->data->GetMaxZ()));
    return retval;
}

/*static*/ PyObject *
SPHResampleAttributes_SetZnum(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the znum in the object.
    obj->data->SetZnum(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetZnum(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetZnum()));
    return retval;
}

/*static*/ PyObject *
SPHResampleAttributes_SetTensorSupportVariable(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the tensorSupportVariable in the object.
    obj->data->SetTensorSupportVariable(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetTensorSupportVariable(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetTensorSupportVariable().c_str());
    return retval;
}

/*static*/ PyObject *
SPHResampleAttributes_SetWeightVariable(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the weightVariable in the object.
    obj->data->SetWeightVariable(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetWeightVariable(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetWeightVariable().c_str());
    return retval;
}

/*static*/ PyObject *
SPHResampleAttributes_SetRK(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the RK in the object.
    obj->data->SetRK(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
SPHResampleAttributes_GetRK(PyObject *self, PyObject *args)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetRK()?1L:0L);
    return retval;
}



PyMethodDef PySPHResampleAttributes_methods[SPHRESAMPLEATTRIBUTES_NMETH] = {
    {"Notify", SPHResampleAttributes_Notify, METH_VARARGS},
    {"SetMinX", SPHResampleAttributes_SetMinX, METH_VARARGS},
    {"GetMinX", SPHResampleAttributes_GetMinX, METH_VARARGS},
    {"SetMaxX", SPHResampleAttributes_SetMaxX, METH_VARARGS},
    {"GetMaxX", SPHResampleAttributes_GetMaxX, METH_VARARGS},
    {"SetXnum", SPHResampleAttributes_SetXnum, METH_VARARGS},
    {"GetXnum", SPHResampleAttributes_GetXnum, METH_VARARGS},
    {"SetMinY", SPHResampleAttributes_SetMinY, METH_VARARGS},
    {"GetMinY", SPHResampleAttributes_GetMinY, METH_VARARGS},
    {"SetMaxY", SPHResampleAttributes_SetMaxY, METH_VARARGS},
    {"GetMaxY", SPHResampleAttributes_GetMaxY, METH_VARARGS},
    {"SetYnum", SPHResampleAttributes_SetYnum, METH_VARARGS},
    {"GetYnum", SPHResampleAttributes_GetYnum, METH_VARARGS},
    {"SetMinZ", SPHResampleAttributes_SetMinZ, METH_VARARGS},
    {"GetMinZ", SPHResampleAttributes_GetMinZ, METH_VARARGS},
    {"SetMaxZ", SPHResampleAttributes_SetMaxZ, METH_VARARGS},
    {"GetMaxZ", SPHResampleAttributes_GetMaxZ, METH_VARARGS},
    {"SetZnum", SPHResampleAttributes_SetZnum, METH_VARARGS},
    {"GetZnum", SPHResampleAttributes_GetZnum, METH_VARARGS},
    {"SetTensorSupportVariable", SPHResampleAttributes_SetTensorSupportVariable, METH_VARARGS},
    {"GetTensorSupportVariable", SPHResampleAttributes_GetTensorSupportVariable, METH_VARARGS},
    {"SetWeightVariable", SPHResampleAttributes_SetWeightVariable, METH_VARARGS},
    {"GetWeightVariable", SPHResampleAttributes_GetWeightVariable, METH_VARARGS},
    {"SetRK", SPHResampleAttributes_SetRK, METH_VARARGS},
    {"GetRK", SPHResampleAttributes_GetRK, METH_VARARGS},
    {NULL, NULL}
};

//
// Type functions
//

static void
SPHResampleAttributes_dealloc(PyObject *v)
{
   SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)v;
   if(obj->parent != 0)
       Py_DECREF(obj->parent);
   if(obj->owns)
       delete obj->data;
}

static PyObject *SPHResampleAttributes_richcompare(PyObject *self, PyObject *other, int op);
PyObject *
PySPHResampleAttributes_getattr(PyObject *self, char *name)
{
    if(strcmp(name, "minX") == 0)
        return SPHResampleAttributes_GetMinX(self, NULL);
    if(strcmp(name, "maxX") == 0)
        return SPHResampleAttributes_GetMaxX(self, NULL);
    if(strcmp(name, "xnum") == 0)
        return SPHResampleAttributes_GetXnum(self, NULL);
    if(strcmp(name, "minY") == 0)
        return SPHResampleAttributes_GetMinY(self, NULL);
    if(strcmp(name, "maxY") == 0)
        return SPHResampleAttributes_GetMaxY(self, NULL);
    if(strcmp(name, "ynum") == 0)
        return SPHResampleAttributes_GetYnum(self, NULL);
    if(strcmp(name, "minZ") == 0)
        return SPHResampleAttributes_GetMinZ(self, NULL);
    if(strcmp(name, "maxZ") == 0)
        return SPHResampleAttributes_GetMaxZ(self, NULL);
    if(strcmp(name, "znum") == 0)
        return SPHResampleAttributes_GetZnum(self, NULL);
    if(strcmp(name, "tensorSupportVariable") == 0)
        return SPHResampleAttributes_GetTensorSupportVariable(self, NULL);
    if(strcmp(name, "weightVariable") == 0)
        return SPHResampleAttributes_GetWeightVariable(self, NULL);
    if(strcmp(name, "RK") == 0)
        return SPHResampleAttributes_GetRK(self, NULL);


    // Add a __dict__ answer so that dir() works
    if (!strcmp(name, "__dict__"))
    {
        PyObject *result = PyDict_New();
        for (int i = 0; PySPHResampleAttributes_methods[i].ml_meth; i++)
            PyDict_SetItem(result,
                PyString_FromString(PySPHResampleAttributes_methods[i].ml_name),
                PyString_FromString(PySPHResampleAttributes_methods[i].ml_name));
        return result;
    }

    return Py_FindMethod(PySPHResampleAttributes_methods, self, name);
}

int
PySPHResampleAttributes_setattr(PyObject *self, char *name, PyObject *args)
{
    PyObject NULL_PY_OBJ;
    PyObject *obj = &NULL_PY_OBJ;

    if(strcmp(name, "minX") == 0)
        obj = SPHResampleAttributes_SetMinX(self, args);
    else if(strcmp(name, "maxX") == 0)
        obj = SPHResampleAttributes_SetMaxX(self, args);
    else if(strcmp(name, "xnum") == 0)
        obj = SPHResampleAttributes_SetXnum(self, args);
    else if(strcmp(name, "minY") == 0)
        obj = SPHResampleAttributes_SetMinY(self, args);
    else if(strcmp(name, "maxY") == 0)
        obj = SPHResampleAttributes_SetMaxY(self, args);
    else if(strcmp(name, "ynum") == 0)
        obj = SPHResampleAttributes_SetYnum(self, args);
    else if(strcmp(name, "minZ") == 0)
        obj = SPHResampleAttributes_SetMinZ(self, args);
    else if(strcmp(name, "maxZ") == 0)
        obj = SPHResampleAttributes_SetMaxZ(self, args);
    else if(strcmp(name, "znum") == 0)
        obj = SPHResampleAttributes_SetZnum(self, args);
    else if(strcmp(name, "tensorSupportVariable") == 0)
        obj = SPHResampleAttributes_SetTensorSupportVariable(self, args);
    else if(strcmp(name, "weightVariable") == 0)
        obj = SPHResampleAttributes_SetWeightVariable(self, args);
    else if(strcmp(name, "RK") == 0)
        obj = SPHResampleAttributes_SetRK(self, args);

    if (obj != NULL && obj != &NULL_PY_OBJ)
        Py_DECREF(obj);

    if (obj == &NULL_PY_OBJ)
    {
        obj = NULL;
        PyErr_Format(PyExc_NameError, "name '%s' is not defined", name);
    }
    else if (obj == NULL && !PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "unknown problem with '%s'", name);

    return (obj != NULL) ? 0 : -1;
}

static int
SPHResampleAttributes_print(PyObject *v, FILE *fp, int flags)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)v;
    fprintf(fp, "%s", PySPHResampleAttributes_ToString(obj->data, "",false).c_str());
    return 0;
}

PyObject *
SPHResampleAttributes_str(PyObject *v)
{
    SPHResampleAttributesObject *obj = (SPHResampleAttributesObject *)v;
    return PyString_FromString(PySPHResampleAttributes_ToString(obj->data,"", false).c_str());
}

//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *SPHResampleAttributes_Purpose = "";
#else
static char *SPHResampleAttributes_Purpose = "";
#endif

//
// Python Type Struct Def Macro from Py2and3Support.h
//
//         VISIT_PY_TYPE_OBJ( VPY_TYPE,
//                            VPY_NAME,
//                            VPY_OBJECT,
//                            VPY_DEALLOC,
//                            VPY_PRINT,
//                            VPY_GETATTR,
//                            VPY_SETATTR,
//                            VPY_STR,
//                            VPY_PURPOSE,
//                            VPY_RICHCOMP,
//                            VPY_AS_NUMBER)

//
// The type description structure
//

VISIT_PY_TYPE_OBJ(SPHResampleAttributesType,         \
                  "SPHResampleAttributes",           \
                  SPHResampleAttributesObject,       \
                  SPHResampleAttributes_dealloc,     \
                  SPHResampleAttributes_print,       \
                  PySPHResampleAttributes_getattr,   \
                  PySPHResampleAttributes_setattr,   \
                  SPHResampleAttributes_str,         \
                  SPHResampleAttributes_Purpose,     \
                  SPHResampleAttributes_richcompare, \
                  0); /* as_number*/

//
// Helper function for comparing.
//
static PyObject *
SPHResampleAttributes_richcompare(PyObject *self, PyObject *other, int op)
{
    // only compare against the same type 
    if ( Py_TYPE(self) != &SPHResampleAttributesType
         || Py_TYPE(other) != &SPHResampleAttributesType)
    {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }

    PyObject *res = NULL;
    SPHResampleAttributes *a = ((SPHResampleAttributesObject *)self)->data;
    SPHResampleAttributes *b = ((SPHResampleAttributesObject *)other)->data;

    switch (op)
    {
       case Py_EQ:
           res = (*a == *b) ? Py_True : Py_False;
           break;
       case Py_NE:
           res = (*a != *b) ? Py_True : Py_False;
           break;
       default:
           res = Py_NotImplemented;
           break;
    }

    Py_INCREF(res);
    return res;
}

//
// Helper functions for object allocation.
//

static SPHResampleAttributes *defaultAtts = 0;
static SPHResampleAttributes *currentAtts = 0;

static PyObject *
NewSPHResampleAttributes(int useCurrent)
{
    SPHResampleAttributesObject *newObject;
    newObject = PyObject_NEW(SPHResampleAttributesObject, &SPHResampleAttributesType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new SPHResampleAttributes(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new SPHResampleAttributes(*defaultAtts);
    else
        newObject->data = new SPHResampleAttributes;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

static PyObject *
WrapSPHResampleAttributes(const SPHResampleAttributes *attr)
{
    SPHResampleAttributesObject *newObject;
    newObject = PyObject_NEW(SPHResampleAttributesObject, &SPHResampleAttributesType);
    if(newObject == NULL)
        return NULL;
    newObject->data = (SPHResampleAttributes *)attr;
    newObject->owns = false;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

///////////////////////////////////////////////////////////////////////////////
//
// Interface that is exposed to the VisIt module.
//
///////////////////////////////////////////////////////////////////////////////

PyObject *
SPHResampleAttributes_new(PyObject *self, PyObject *args)
{
    int useCurrent = 0;
    if (!PyArg_ParseTuple(args, "i", &useCurrent))
    {
        if (!PyArg_ParseTuple(args, ""))
            return NULL;
        else
            PyErr_Clear();
    }

    return (PyObject *)NewSPHResampleAttributes(useCurrent);
}

//
// Plugin method table. These methods are added to the visitmodule's methods.
//
static PyMethodDef SPHResampleAttributesMethods[] = {
    {"SPHResampleAttributes", SPHResampleAttributes_new, METH_VARARGS},
    {NULL,      NULL}        /* Sentinel */
};

static Observer *SPHResampleAttributesObserver = 0;

std::string
PySPHResampleAttributes_GetLogString()
{
    std::string s("SPHResampleAtts = SPHResampleAttributes()\n");
    if(currentAtts != 0)
        s += PySPHResampleAttributes_ToString(currentAtts, "SPHResampleAtts.", true);
    return s;
}

static void
PySPHResampleAttributes_CallLogRoutine(Subject *subj, void *data)
{
    typedef void (*logCallback)(const std::string &);
    logCallback cb = (logCallback)data;

    if(cb != 0)
    {
        std::string s("SPHResampleAtts = SPHResampleAttributes()\n");
        s += PySPHResampleAttributes_ToString(currentAtts, "SPHResampleAtts.", true);
        cb(s);
    }
}

void
PySPHResampleAttributes_StartUp(SPHResampleAttributes *subj, void *data)
{
    if(subj == 0)
        return;

    currentAtts = subj;
    PySPHResampleAttributes_SetDefaults(subj);

    //
    // Create the observer that will be notified when the attributes change.
    //
    if(SPHResampleAttributesObserver == 0)
    {
        SPHResampleAttributesObserver = new ObserverToCallback(subj,
            PySPHResampleAttributes_CallLogRoutine, (void *)data);
    }

}

void
PySPHResampleAttributes_CloseDown()
{
    delete defaultAtts;
    defaultAtts = 0;
    delete SPHResampleAttributesObserver;
    SPHResampleAttributesObserver = 0;
}

PyMethodDef *
PySPHResampleAttributes_GetMethodTable(int *nMethods)
{
    *nMethods = 1;
    return SPHResampleAttributesMethods;
}

bool
PySPHResampleAttributes_Check(PyObject *obj)
{
    return (obj->ob_type == &SPHResampleAttributesType);
}

SPHResampleAttributes *
PySPHResampleAttributes_FromPyObject(PyObject *obj)
{
    SPHResampleAttributesObject *obj2 = (SPHResampleAttributesObject *)obj;
    return obj2->data;
}

PyObject *
PySPHResampleAttributes_New()
{
    return NewSPHResampleAttributes(0);
}

PyObject *
PySPHResampleAttributes_Wrap(const SPHResampleAttributes *attr)
{
    return WrapSPHResampleAttributes(attr);
}

void
PySPHResampleAttributes_SetParent(PyObject *obj, PyObject *parent)
{
    SPHResampleAttributesObject *obj2 = (SPHResampleAttributesObject *)obj;
    obj2->parent = parent;
}

void
PySPHResampleAttributes_SetDefaults(const SPHResampleAttributes *atts)
{
    if(defaultAtts)
        delete defaultAtts;

    defaultAtts = new SPHResampleAttributes(*atts);
}

